package com.inspur.jzsxxzx.service.muluzhili.impl;

import com.inspur.jzsxxzx.entity.muluzhili.UpDataReconciliation;
import com.inspur.jzsxxzx.mapper.muluzhili.UpDataReconciliationMapper;
import com.inspur.jzsxxzx.service.muluzhili.UpDataReconciliationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class UpDataReconciliationServiceImpl implements UpDataReconciliationService {

    @Autowired
    private UpDataReconciliationMapper upDataReconciliationMapper;

    @Override
    public List<UpDataReconciliation> findAll() {
        return upDataReconciliationMapper.findAll();
    }

    @Override
    public UpDataReconciliation findById(Integer id) {
        return upDataReconciliationMapper.findById(id);
    }

    @Override
    public boolean save(UpDataReconciliation upDataReconciliation) {
        try {
            return upDataReconciliationMapper.insert(upDataReconciliation) > 0;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public boolean update(UpDataReconciliation upDataReconciliation) {
        try {
            return upDataReconciliationMapper.update(upDataReconciliation) > 0;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public boolean deleteById(Integer id) {
        try {
            return upDataReconciliationMapper.deleteById(id) > 0;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public boolean batchSave(List<UpDataReconciliation> upDataReconciliationList) {
        try {
            return upDataReconciliationMapper.batchInsert(upDataReconciliationList) > 0;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public Integer findMaxId() {
        try {
            return upDataReconciliationMapper.findMaxId();
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

    @Override
    public List<UpDataReconciliation> findByRegionCodeAndCdBatch(String tableName, String regionCode, String cdBatch) {
        return upDataReconciliationMapper.findByRegionCodeAndCdBatch(tableName , regionCode, cdBatch);
    }
}